runOnStartup(async runtime => {
    window.addEventListener("minerTick", (e) => {
    })
    window.addEventListener("minerInit", (e) => {
        MinerSpwn.spwnMiner()
    })
});
globalThis.MinerSpwn = {
    spwnMiner: function () {
        let minerGameplayer = runtime.objects.point_minerGamePlaye.getFirstInstance()
        if (minerGameplayer == null) return
        let cu_day = runtime.globalVars.CurDay
        let _spwnMask = runtime.objects.MinerSpwnMask.getFirstInstance()
        let maskMINpoint = 0
        let maskMAXpoint = 25
        if (cu_day >= 1 && cu_day < 3) {
            for (let i = 0; i < 50; i++) {

                let x = _spwnMask.getImagePointX(cc_GamewithMath.RandomNum(maskMINpoint, maskMAXpoint))+ cc_GamewithMath.RandomNum(-15, 15)
                let y = _spwnMask.getImagePointY(cc_GamewithMath.RandomNum(maskMINpoint, maskMAXpoint))+ cc_GamewithMath.RandomNum(-15, 15)
                let newStone = runtime.objects.stone.createInstance("Map", x, y, true)
                newStone.angle = cc_GamewithMath.RandomNum(0, 360)
                newStone.width *= cc_GamewithMath.RandomNum(0.7, 1.2)
                newStone.height *= cc_GamewithMath.RandomNum(0.7, 1.2)
            }
            for (let i = 0; i < 30; i++) {
                let x = _spwnMask.getImagePointX(cc_GamewithMath.RandomNum(maskMINpoint, maskMAXpoint))+ cc_GamewithMath.RandomNum(-15, 15)
                let y = _spwnMask.getImagePointY(cc_GamewithMath.RandomNum(maskMINpoint, maskMAXpoint))+ cc_GamewithMath.RandomNum(-15, 15)
                let newGoldon = runtime.objects.golden.createInstance("Map", x, y, true)
                newGoldon.angle = cc_GamewithMath.RandomNum(0, 360)
                newGoldon.width *= cc_GamewithMath.RandomNum(0.7, 1.2)
                newGoldon.height *= cc_GamewithMath.RandomNum(0.7, 1.2)
            }
            for (let i = 0; i < 30; i++) {
                let x = _spwnMask.getImagePointX(cc_GamewithMath.RandomNum(maskMINpoint, maskMAXpoint)) + cc_GamewithMath.RandomNum(-15, 15)
                let y = _spwnMask.getImagePointY(cc_GamewithMath.RandomNum(maskMINpoint, maskMAXpoint)) + cc_GamewithMath.RandomNum(-15, 15)
                let newGoldonSmall = runtime.objects.goldensmall.createInstance("Map", x, y, true)
                newGoldonSmall.angle = cc_GamewithMath.RandomNum(0, 360)
                newGoldonSmall.width *= cc_GamewithMath.RandomNum(0.7, 1.2)
                newGoldonSmall.height *= cc_GamewithMath.RandomNum(0.7, 1.2)
            }
        }
        if (cu_day >= 3 && cu_day < 6) {
        }
        if (cu_day >= 6 && cu_day < 10) {
        }
        if (cu_day >= 10 && cu_day < 15) {
        }
        /**
         * gIFt Day
         */
        if (cu_day == 5) {
        }
    },
}
export default MinerSpwn